Roughly equivalent to 'jhbuild info'.
src/ostbuild/pyostbuild/builtin_commit_artifacts.py \
src/ostbuild/pyostbuild/builtin_compile_one.py \
src/ostbuild/pyostbuild/builtin_resolve.py \
+ src/ostbuild/pyostbuild/builtin_status.py \
src/ostbuild/pyostbuild/builtins.py \
src/ostbuild/pyostbuild/filemonitor.py \
src/ostbuild/pyostbuild/__init__.py \
args.append(commit)
version = run_sync_get_output(args, cwd=dirpath)
return version.strip()
+
+def manifest_target(manifest, architecture):
+ return '%s-%s-devel' % (manifest['name'], architecture)
+
+def manifest_base(manifest, roottype, architecture):
+ return 'bases/%s-%s-%s' % (manifest['base'],
+ architecture, roottype)
+
+def manifest_buildname(manifest, component, architecture):
+ return 'artifacts/%s/%s/%s' % (manifest_target (manifest, architecture),
+ component['name'],
+ component['branch'])
+
+def manifest_buildroot_name(manifest, component, architecture):
+ return 'buildroots/%s/%s/%s' % (manifest_target (manifest, architecture),
+ component['name'],
+ component['branch'])
return result
- def _get_target(self, architecture):
- return '%s-%s-devel' % (self.manifest['name'], architecture)
-
- def _get_base(self, roottype, architecture):
- return 'bases/%s-%s-%s' % (self.manifest['base'],
- architecture, roottype)
-
- def _get_buildname(self, component, architecture):
- return 'artifacts/%s/%s/%s' % (self._get_target (architecture),
- component['name'],
- component['branch'])
-
- def _get_buildroot_name(self, component, architecture):
- return 'buildroots/%s/%s/%s' % (self._get_target (architecture),
- component['name'],
- component['branch'])
-
def _compose_buildroot(self, buildroot_name, component, dependencies, architecture):
- base = self._get_base('devel', architecture)
+ base = buildutil.manifest_base(self.manifest, 'devel', architecture)
buildroot_contents = [base + ':/']
for dep in dependencies:
- dep_buildname = self._get_buildname(dep, architecture)
+ dep_buildname = buildutil.manifest_buildname(self.manifest, dep, architecture)
buildroot_contents.append(dep_buildname + ':/runtime')
buildroot_contents.append(dep_buildname + ':/devel')
name = meta['name']
branch = meta['branch']
- target = self._get_target(architecture)
- buildname = self._get_buildname(meta, architecture)
- buildroot_name = self._get_buildroot_name(meta, architecture)
+ target = buildutil.manifest_target(self.manifest, architecture)
+ buildname = buildutil.manifest_buildname(self.manifest, meta, architecture)
+ buildroot_name = buildutil.manifest_buildroot_name(self.manifest, meta, architecture)
(keytype, uri) = buildutil.parse_src_key(meta['src'])
return revision
def _compose_arch(self, architecture, components):
- runtime_base = self._get_base('runtime', architecture)
- devel_base = self._get_base('devel', architecture)
+ runtime_base = buildutil.manifest_base(self.manifest, 'runtime', architecture)
+ devel_base = buildutil.manifest_base(self.manifest, 'devel', architecture)
runtime_contents = [runtime_base + ':/']
devel_contents = [devel_base + ':/']
for component in components:
- branch = self._get_buildname(component, architecture)
+ branch = buildutil.manifest_buildname(self.manifest, component, architecture)
runtime_contents.append(branch + ':/runtime')
devel_contents.append(branch + ':/runtime')
# For now just hardcode docs going in devel
--- /dev/null
+# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# ostbuild-compile-one-make wraps systems that implement the GNOME build API:
+# http://people.gnome.org/~walters/docs/build-api.txt
+
+import os,sys,stat,subprocess,tempfile,re,shutil
+from StringIO import StringIO
+import json
+
+from . import builtins
+from .ostbuildlog import log, fatal
+from .subprocess_helpers import run_sync, run_sync_get_output
+from . import buildutil
+
+class OstbuildStatus(builtins.Builtin):
+ name = "status"
+ short_description = "Show build status"
+
+ def __init__(self):
+ builtins.Builtin.__init__(self)
+
+ def execute(self, args):
+ self.parse_config()
+ build_manifest_path = os.path.join(self.workdir, 'manifest.json')
+ self.manifest = json.load(open(build_manifest_path))
+
+ for architecture in self.manifest['architectures']:
+ for component in self.manifest['components']:
+ branch = buildutil.manifest_buildname(self.manifest, component, architecture)
+ build_revision = run_sync_get_output(['ostree', '--repo=' + self.repo,
+ 'show',
+ '--print-metadata-key=ostbuild-artifact-version',
+ branch],
+ none_on_error=True)
+ if build_revision is None:
+ build_revision = '(not built)'
+ if build_revision != component['revision']:
+ build_status = '(needs build)'
+ else:
+ build_status = 'ok'
+ sys.stdout.write('{:<40} {:<95} {:<10}\n'.format(component['name'],
+ build_revision, build_status))
+
+
+builtins.register(OstbuildStatus)
from . import builtin_commit_artifacts
from . import builtin_compile_one
from . import builtin_resolve
+from . import builtin_status
def usage(ecode):
print "Builtins:"